<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Product extends MY_Controller {
// Some code happens here
    public function __construct()
    {
        parent:: __construct();
        $this->load->helper("url");
	    $this->load->model('sanpham');
        $this->load->library('url');    
        $this->load->helper('html');
		$this->load->helper('text');
	    $this->load->library('parser');
        $this->load->library('pagination');
    }
	
	public function index()
	{
        $this->page(0);
	}

   function get_product_category($category = 'all_product')
   { 
                
            $this->post['html']='';
            $arrProducts = $this->sanpham->get_product_category($category);
            foreach($arrProducts as $product)
            {   
                $data['id'] = $product->ID;
                $data['name']=$product->TenSP;
                $data['gia']=$product->Gia;
                $data['tooltip'] = $this->view_tooltip($data);
                $this->post['html'].= $this->parser->parse('main/product_item_simp',$data,true);
            }
           $html2 = $this->parser->parse('home/content',$this->post,true);
           echo $html2.$html; 
	}
}